import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from "@/views/Login.vue";
import Register from "@/views/Register.vue";
import ProductPublish from "@/views/ProductPublish.vue";
import ProductList from "@/views/ProductList.vue";
import UserInfo from "@/views/UserInfo.vue";
import MessagePage from "@/views/MessagePage.vue";
import OrderList from "@/views/OrderList.vue";
import Cart from "@/views/Cart.vue";
import test from "@/views/test.vue";

Vue.use(VueRouter)

const routes = [
  { path: "/login", component: Login, meta: { layout: 'LayoutEmpty' } },
  { path: "/register", component: Register, meta: { layout: 'LayoutEmpty' }},
  { path: "/", redirect: "/product", meta: { layout: 'LayoutEmpty' }},
  { path: "/publish", component: ProductPublish, meta: { layout: 'LayoutDefault' }},
  { path: "/product", component: ProductList, meta: { layout: 'LayoutDefault' }},
  // { path: "/message", component: MessagePage, meta: { layout: 'LayoutDefault' }},
  { path: "/order", component: OrderList, meta: { layout: 'LayoutDefault' }},
  { path: "/cart", component: Cart, meta: { layout: 'LayoutDefault' }},
  { path: "/test", component: test, meta: { layout: 'LayoutDefault' }},
  { path: '/userinfo/:userId', name: 'userinfo', component: UserInfo, props: true },
  { path: '/message/:userId', name: 'message', component: MessagePage, props: true }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
